<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
	<meta charset="utf-8"> 
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=500" />
	<meta name="keywords" content="ScrollMagic, example, scrolling, attaching, scrollbar, anchor, link, in-page, navigation, hash" />
	<meta name="author"	content="Jan Paepke (www.janpaepke.de)" />
	<title>Section Wipes (natural) - Examples - ScrollMagic</title>

	<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic|Josefin+Slab:400,700italic' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="../../assets/css/normalize.css" type="text/css">
	<link rel="stylesheet" href="../../assets/css/style.css" type="text/css">
	<link rel="stylesheet" href="../../assets/css/examples.css" type="text/css">
	<link rel="shortcut icon" href="../../assets/img/favicon.ico" type="image/x-icon">

	<script type="text/javascript" src="../../assets/js/lib/jquery.min.js"></script>
	<script type="text/javascript" src="../../assets/js/lib/highlight.pack.js"></script>
	<script type="text/javascript" src="../../assets/js/lib/modernizr.custom.min.js"></script>
	<script type="text/javascript" src="../../assets/js/examples.js"></script>
	
	<script type="text/javascript" src="../../scrollmagic/uncompressed/ScrollMagic.js"></script>
	<script type="text/javascript" src="../../scrollmagic/uncompressed/plugins/debug.addIndicators.js"></script>
</head>
<body>
	<ul id="menu"></ul>
	<div id="content-wrapper">
		<div id="example-wrapper">
			<div class="scrollContent">
				<section id="titlechart">
					<div id="description">
						<h1>Section Wipes (natural)</h1>
						<h2>Wiping in content with the natural scroll movement</h2>
						<p>This commonly used effect can be very easily achieved using ScrollMagic's <code>Scene.setPin()</code> method.</p>
						<p>If you want to create a "pause" between the slides, simply add a <code>margin-bottom</code> to them (see between slide 3 and 4).</p>
						<a href="#" class="viewsource">view source</a>
					</div>
				</section>
				<section class="demo" id="section-wipes">
					<style type="text/css">
						.panel {
							height: 100%;
							width: 100%;
						}
						.panel.green {
							margin-bottom: 400px
						}
					</style>
					<section class="panel blue">
						<b>ONE</b>
					</section>
					<section class="panel turqoise">
						<b>TWO</b>
					</section>
					<section class="panel green">
						<b>THREE</b>
					</section>
					<section class="panel bordeaux">
						<b>FOUR</b>
					</section>
					<script>
						$(function () { // wait for document ready
							// init
							var controller = new ScrollMagic.Controller({
								globalSceneOptions: {
									triggerHook: 'onLeave',
									duration: "200%" // this works just fine with duration 0 as well
									// However with large numbers (>20) of pinned sections display errors can occur so every section should be unpinned once it's covered by the next section.
									// Normally 100% would work for this, but here 200% is used, as Panel 3 is shown for more than 100% of scrollheight due to the pause.
								}
							});

							// get all slides
							var slides = document.querySelectorAll("section.panel");

							// create scene for every slide
							for (var i=0; i<slides.length; i++) {
								new ScrollMagic.Scene({
										triggerElement: slides[i]
									})
									.setPin(slides[i], {pushFollowers: false})
									.addIndicators() // add indicators (requires plugin)
									.addTo(controller);
							}
						});
					</script>
				</section>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="../../assets/js/tracking.js"></script>
</body>
</html>
